import requests
from bs4 import BeautifulSoup

url = 'https://top.baidu.com/board?tab=realtime'
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'}
r = requests.get(url, headers=headers, timeout=30)
r.encoding = r.apparent_encoding
soup = BeautifulSoup(r.text,'html.parser')
title_list=soup.find_all(attrs={'class':'c-single-text-ellipsis'})
hot_list=soup.find_all(attrs={'class':'hot-index_1Bl1a'})
for j in range(len(title_list)):
    print(str((j+1)) + '.' + str(title_list[j].get_text())+'('+'热度指数'+':'+str(hot_list[j].get_text())+')')